package com.ezjie.ielts.task;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.ezjie.ielts.constant.Constants;
import com.ezjie.ielts.core.http.HttpAPI;
import com.ezjie.ielts.core.http.HttpRequestCallBack;
import com.ezjie.ielts.core.http.ServerInterfaceDefinition;

public class ErrorQuestionTask {
	private Context context;

	public ErrorQuestionTask(Context context) {
		this.context = context;
	}

	/**
	 * 错题重练 （question_type=reading）
	 * 
	 * @param httpRequestCallBack
	 */
	public void getErrorQuestions(String question_type, HttpRequestCallBack httpRequestCallBack) {
		Map<String, String> params = new HashMap<String, String>();
		params.put(Constants.PARAMS_QUESTION_TYPE, question_type);

		HttpAPI.getInstance(context)
				.doGetRequest(ServerInterfaceDefinition.OPT_READ_ERROR, params, httpRequestCallBack);
	}

	/**
	 * 提交错题重练 （question_type=reading）
	 * 
	 * @param httpRequestCallBack
	 */
	public void submitErrorQuestions(String questions, HttpRequestCallBack httpRequestCallBack) {
		Map<String, String> params = new HashMap<String, String>();
		params.put(Constants.PARAMS_QUESTIONS, questions);

		HttpAPI.getInstance(context).doPostRequest(ServerInterfaceDefinition.OPT_READ_ERROR, params,
				httpRequestCallBack);
	}
}
